const mql = require("../DB/USER_MYSQL_DATABASE")
const moment = require('moment')
// sql语句
const time = moment().valueOf()
const delUser = async (id) => {
    return await mql.query(`delete from user_list where id =${id}`)
}
const addUser = async (data) => {
    // return await mql.query(`insert into user_list( updata_time, name, age, height, class,) values(${time}, '${data.name}', ${data.age}, ${data.height},'${data.class}'`)
    return await mql.query(`INSERT INTO user_list(updata_time, name, age, height, class) VALUES(${time}, '${data.name}', ${data.age}, ${data.height}, '${data.class}')`)
}
const setUser = async (id, data) => {
    return await mql.query(`update user_list set name ='${data.name}',  age= ${data.age}, height=${data.height}  where id = ${id}`)
}
const searchUserList = async (data) => {
    return await mql.query(`select * from user_list where `)
}

const getUserInfor = async () => {
    return await mql.query(`select * from user_list`)
}


module.exports = { delUser, addUser, setUser, getUserInfor }